package com.aos.erp.message.mapper;

import com.aos.erp.common.dao.mapper.SuperMapper;
import com.aos.erp.message.dto.MessageRecordItemDTO;
import com.aos.erp.message.model.MessageRecordInfo;
import com.aos.erp.message.model.vo.MRConditionVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;


public interface MessageRecordMapper extends SuperMapper<MessageRecordInfo> {

    /**
     * 分页查询消息记录列表
     * @param pageBean
     * @param param
     * @return
     */
    List<MessageRecordItemDTO> pageRecordList(IPage<MessageRecordItemDTO> pageBean, @Param("param") MRConditionVo param);

    @Update("update t_message_record set mr_push_count=mr_push_count+1, push_time=now(),push_status=2,mr_content='${sendResult}' where id=${dataId}")
    void pushMessage(@Param("dataId") long dataId, @Param("sendResult") String sendResult);

    @Update("update t_message_record set is_del=-1 where id in (${dataId})")
    void deleteRecord(@Param("dataId") String dataId);
}
